import request from '@/utils/request'

//新增指标目标预警
export function warningAdd(data) {
  return request({
    url: '/jtx/matrix/warning/add',
    method: 'post',
    data,
  })
}

//预警状态变更
export function warningChangeStatus(data) {
  return request({
    url: '/jtx/matrix/warning/changeStatus/',
    method: 'post',
    data,
  })
}

//修改指标目标预警
export function warningEdit(data) {
  return request({
    url: '/jtx/matrix/warning/edit',
    method: 'post',
    data,
  })
}

//查询指标目标预警列表
export function warningPage(data) {
  return request({
    url: '/jtx/matrix/warning/page',
    method: 'post',
    data,
  })
}

//删除指标目标预警
export function warningRemove(data) {
  console.log(data)
  if (Array.isArray(data)) {
    data = data.map((item) => item.id)
  }
  return request({
    url: '/jtx/matrix/warning/remove',
    method: 'post',
    data,
  })
}

//获取指标目标预警详细信息
export function warningGet(data) {
  return request({
    url: `/jtx/matrix/warning/${data.id}`,
    method: 'get',
  })
}
